Skip to content

examples: add multi-turn conversation with TEE verification#210

Merged
adambalogh merged 1 commit intoOpenGradient:mainfrom
ygd58:examples/multi-turn-conversation
Apr 1, 2026
Merged

examples: add multi-turn conversation with TEE verification#210
adambalogh merged 1 commit intoOpenGradient:mainfrom
ygd58:examples/multi-turn-conversation

Conversation

@ygd58
Copy link
Copy Markdown
Contributor

@ygd58 ygd58 commented Mar 27, 2026

Summary

Adds examples/llm_multi_turn_conversation.py — a missing but commonly
needed usage pattern not covered by existing examples.

What it demonstrates

  • Maintaining conversation history across multiple turns
  • Context-aware follow-up questions (each turn references the previous)
  • Capturing the transaction hash from every inference step for on-chain verification
  • Clean helper functions (add_user_message, add_assistant_message) for history management

Why it's useful

The existing examples (llm_chat.py, llm_tool_calling.py) show single-turn
interactions. Real-world applications almost always require multi-turn
conversations. This fills that gap with a clear, runnable example.

Testing

Runs with:
export OG_PRIVATE_KEY="your_private_key"
python examples/llm_multi_turn_conversation.py

Shows how to maintain conversation history across turns while
getting a cryptographic transaction hash for every inference step.
Each turn builds on the previous context, demonstrating real-world
usage patterns for stateful LLM applications on OpenGradient.
@adambalogh adambalogh merged commit 709bf3a into OpenGradient:main Apr 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants